<php>
$_REQUEST['goPageFun']="goPageBSub";//设定分页调用函数
if(empty($bsub_brandid))$bsub_brandid	= $_REQUEST['brandid'];	//商户id	
$bsub_area_id	= $_REQUEST['area_id'];	//区域id	
$bsub_city_id	= $_REQUEST['city_id'];	//城市id
$bsub_bsubpage 	= service('Brand')->search4UserBSub($bsub_brandid,$bsub_area_id,$bsub_city_id);
if(empty($bsub_bsubpage)||empty($bsub_bsubpage['data'])){
</php>
	<div class="addr-box">
		<div class="page_box">无相关分店记录！</div>
	</div>
<php>}else{
$index=0;</php>
</php>


	<script type="text/javascript">
	//<!CDATA[
	$(function(){
		initMap("map-box","39.925","116.385",12);
		cleanAll();
		var store_infos = eval('( ' + $('#store_json_data').html() + ' )');
		store_markers = drawStoreMarkers(store_infos,marker_icon);
		map.centerAndZoom( store_markers ,12 );
		initStoreList();
		initstyle();
	});
	/**
	 * 返回店铺列表后，页面执行的初始化方法。
	 */
	function initStoreList(){
		$("#bsub_list_area").find('#addr_drief').each(function(){
			$(this).hover(
					function(){
						//当鼠标放上去的时候,程序处理
						var _rel = $(this).attr('rel');
						var _ttmp_marker = getStoreMarker(_rel);
						if(_ttmp_marker!=null){
							_ttmp_marker.marker.setIcon(marker_icon_hover);
						}
					},

					function(){
					   	//当鼠标离开的时候,程序处理
						var _rel = $(this).attr('rel');
						var _ttmp_marker = getStoreMarker(_rel);
						if(_ttmp_marker!=null){
							_ttmp_marker.marker.setIcon(marker_icon);
						}
					}
			);
			$(this).unbind('click');
			$(this).click(function(){
				var _rel = $(this).attr('rel');
				var _ttmp_marker = getStoreMarker(_rel);
				if(_ttmp_marker!=null){
					var _infoWindow = getStoreInfoWindow(new BMap.Size(0, _ttmp_marker.marker.getIcon().size.height*(-1) ),_ttmp_marker.storeinfo);
					_ttmp_marker.marker.openInfoWindow(_infoWindow);
				}else{
					ui.error('地图坐标未设定！');
				}
			});
		});
	}
	function initstyle(){
	    $("#bsub_list_area").find('#addr_drief').each(function(){
	    	$(this).hover(
	    		      function () {
	    			  		$(this).addClass("addr-box_on");
	    			  },
	    			  function () {
	    			        $(this).removeClass("addr-box_on");
	    			  }
	    	);
	    });
	}
	//]]>
	</script>
  	<div id="store_json_data" class="hidden">
		<php>
		if(count($bsub_bsubpage['data'])>0){
			echo json_encode( format2MapData($bsub_bsubpage['data']) );
		}
		</php>
	</div>

	<volist id="vo" name="bsub_bsubpage['data']">
		<php>
		$_tmp_phone='';
		if($vo['phone']>0)$_tmp_phone=$vo['phone'];
		if($vo['mobile']>0){
			if(!empty($_tmp_phone))$_tmp_phone=$_tmp_phone.' / '.$vo['mobile'];
			else $_tmp_phone=$vo['mobile'];
		}
		</php>
		<div class="addr-box" id='addr_drief' rel="{$vo['id']}">
        	<dl>
	            <dt><span class="seq">{$i}</span>{$vo['title']}</dt>
	            <dd><span class="addr">地址:</span>{$vo['address']}</dd>
	            <dd><span class="phone">电话:</span>{$_tmp_phone}</dd>
            </dl>
        </div>
	</volist>
	
	<div id="clear"></div>
	<div class="addr-box">
		<div class="page_box_s">{$bsub_bsubpage['html']}</div>
	</div>
<php>}</php>	
<div id="bsub_search_data" style="display:none;">
<input type="hidden" id="brandid" value="{$bsub_brandid}">
<input type="hidden" id="area_id" value="{$bsub_area_id}">
<input type="hidden" id="city_id" value="{$bsub_city_id}">
</div>